package com.happy.controller;

import com.happy.entity.CourseEntity;
import com.happy.service.ICourseService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: Wuzh
 * @Description:
 * @Date Created in 15:34 2021/1/23
 * @return
 */
@Controller
@CrossOrigin (value = "*", maxAge = 3600)
public class IndexController {

    @Resource
    private ICourseService iCourseService;

    @RequestMapping ( {"/index", "/"})
    public String index ( CourseEntity courseEntity, Model model) {
        List<CourseEntity> courseEntities = iCourseService.queryList ( courseEntity );
        model.addAttribute ( "courseEntities", courseEntities );
        return "index";
    }

}
